package mytool;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by zerdoor_pc on 2015/10/13.
 */
public class ShardPreferencesTool {


    public static void saveshare(Context context,String key,String value){
        try {

        SharedPreferences share =  context.getSharedPreferences("dc", Context.MODE_PRIVATE);
        SharedPreferences.Editor edit = share.edit();
        edit.putString(key, value);
        edit.commit();
        }catch (Exception e){}
    }
    public static void saveshare(Context context,String key,int value){
        try {
        SharedPreferences share =  context.getSharedPreferences("dc", Context.MODE_PRIVATE);
        SharedPreferences.Editor edit = share.edit();
        edit.putInt(key, value);
        edit.commit();
        }catch (Exception e){}
    }
    public static void saveshare(Context context,String key,Boolean value){
        try {


        SharedPreferences share =  context.getSharedPreferences("dc", Context.MODE_PRIVATE);
        SharedPreferences.Editor edit = share.edit();
        edit.putBoolean(key, value);
        edit.commit();
        }catch (Exception e){}
    }



    public static String getshare(Context context,String key,String value){
        try {
            return context.getSharedPreferences("dc", Context.MODE_PRIVATE).getString(key, value);

        }catch (Exception e){
            return value;
        }

    }
    public static int getshare(Context context,String key,int value){
        try {
            return context.getSharedPreferences("dc", Context.MODE_PRIVATE).getInt(key, value);

        }catch (Exception e){
            return value;
        }

    }
    public static Boolean getshare(Context context,String key,Boolean value){
        try {
            return context.getSharedPreferences("dc", Context.MODE_PRIVATE).getBoolean(key, value);

        }catch (Exception e){
            return value;
        }

    }
}
